package com.train.daily.facade.web;

import cn.hutool.core.bean.BeanUtil;
import com.train.common.resp.CommonResp;
import com.train.common.resp.PageResp;
import com.train.daily.dto.station.DailyTrainStationQueryDTO;
import com.train.daily.req.station.DailyTrainStationQueryReq;
import com.train.daily.resp.station.DailyTrainStationPageQueryResp;
import com.train.daily.service.DailyTrainStationService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * dailyTrainStation Facade 实现类
 * @author baitiaojun
 * @createDate 2025-03-01 14:35:49
 */
@RestController("webDailyTrainStationFacade")
@RequiredArgsConstructor
@RequestMapping("train-station")
public class DailyTrainStationFacade {

    private final DailyTrainStationService dailyTrainStationService;

    @PostMapping("station/list")
    public CommonResp queryTrainStationList(@RequestBody DailyTrainStationQueryReq req) {
        DailyTrainStationQueryDTO dto = BeanUtil.copyProperties(req, DailyTrainStationQueryDTO.class);
        PageResp<DailyTrainStationPageQueryResp> resp = dailyTrainStationService.queryTrainStationList(dto);
        return CommonResp.ok(resp);
    }
}
